<!DOCTYPE html>
<html>
<head>
    <title>Simple app</title>

    <script type="text/javascript" src="lib/angular.js"></script>
    <script type="text/javascript">
        var app = angular.module("app", []);
        app.controller('MyController', function ($scope, $parse) {
            $scope.$watch('expr', function (newVal, oldVal, scope) {
                if (newVal !== oldVal) {
                        // Let's set up our parseFun with the expression
                    var parseFun = $parse(newVal);
                        // Get the value of the parsed expression
                    $scope.parsedValue = parseFun(scope);
                }
            });
        });
    </script>
</head>
<body ng-app="app">

<div ng-controller="MyController">
    <input ng-model="expr"
           type="text"
           placeholder="Enter an expression"/>

    <h2>{{ parsedValue }}</h2>
</div>

</body>
</html>